package dto

import (
    "go-admin/app/hunter/models"
    "go-admin/common/dto"
    common "go-admin/common/models"
)

type HtTalentGetPageReq struct {
    dto.Pagination `search:"-"`
    Name           string `form:"name"  search:"type:exact;column:name;table:ht_talent" comment:"姓名"`
    Phone          string `form:"phone"  search:"type:exact;column:phone;table:ht_talent" comment:"手机号"`
    Sex            string `form:"sex"  search:"type:exact;column:sex;table:ht_talent" comment:"性别"`
    Level          string `form:"level"  search:"type:exact;column:level;table:ht_talent" comment:"评级"`
    Note           string `form:"note"  search:"type:contains;column:note;table:ht_talent" comment:"备注信息"`
    ProjectId      int    `form:"projectId" search:"-" comment:"关联表"`
    NameOrPhone    string `form:"nameOrPhone" search:"-" comment:"姓名或电话"`
    HtTalentOrder
}

type HtTalentOrder struct {
    Id        string `form:"idOrder"  search:"type:order;column:id;table:ht_talent"`
    Name      string `form:"nameOrder"  search:"type:order;column:name;table:ht_talent"`
    Phone     string `form:"phoneOrder"  search:"type:order;column:phone;table:ht_talent"`
    Sex       string `form:"sexOrder"  search:"type:order;column:sex;table:ht_talent"`
    Email     string `form:"emailOrder"  search:"type:order;column:email;table:ht_talent"`
    Status    string `form:"statusOrder"  search:"type:order;column:status;table:ht_talent"`
    Level     string `form:"levelOrder"  search:"type:order;column:level;table:ht_talent"`
    Note      string `form:"noteOrder"  search:"type:order;column:note;table:ht_talent"`
    CreateBy  string `form:"createByOrder"  search:"type:order;column:create_by;table:ht_talent"`
    UpdateBy  string `form:"updateByOrder"  search:"type:order;column:update_by;table:ht_talent"`
    CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:ht_talent"`
    UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:ht_talent"`
    DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:ht_talent"`
}

func (m *HtTalentGetPageReq) GetNeedSearch() interface{} {
    return *m
}

type HtTalentInsertReq struct {
    Id        int    `json:"-" comment:"人才id"` // 人才id
    Name      string `json:"name" comment:"姓名"`
    Phone     string `json:"phone" comment:"手机号"`
    Sex       string `json:"sex" comment:"性别"`
    Email     string `json:"email" comment:"邮箱"`
    Status    string `json:"status" comment:"状态"`
    Level     string `json:"level" comment:"评级"`
    Note      string `json:"note" comment:"备注信息"`
    ProjectId int    `json:"projectId" comment:"项目id"`
    common.ControlBy
}

func (s *HtTalentInsertReq) Generate(model *models.HtTalent) {
    if s.Id == 0 {
        model.Model = common.Model{Id: s.Id}
    }
    model.Name = s.Name
    model.Phone = s.Phone
    model.Sex = s.Sex
    model.Email = s.Email
    model.Status = s.Status
    model.Level = s.Level
    model.Note = s.Note
    model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

func (s *HtTalentInsertReq) GetId() interface{} {
    return s.Id
}

type HtTalentUpdateReq struct {
    Id        int    `uri:"id" comment:"人才id"` // 人才id
    Name      string `json:"name" comment:"姓名"`
    Phone     string `json:"phone" comment:"手机号"`
    Sex       string `json:"sex" comment:"性别"`
    Email     string `json:"email" comment:"邮箱"`
    Status    string `json:"status" comment:"状态"`
    Level     string `json:"level" comment:"评级"`
    Note      string `json:"note" comment:"备注信息"`
    ProjectId int    `json:"projectId" comment:"项目id"`
    common.ControlBy
}

func (s *HtTalentUpdateReq) Generate(model *models.HtTalent) {
    if s.Id == 0 {
        model.Model = common.Model{Id: s.Id}
    }
    model.Name = s.Name
    model.Phone = s.Phone
    model.Sex = s.Sex
    model.Email = s.Email
    model.Status = s.Status
    model.Level = s.Level
    model.Note = s.Note
    model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

func (s *HtTalentUpdateReq) GetId() interface{} {
    return s.Id
}

// HtTalentGetReq 功能获取请求参数
type HtTalentGetReq struct {
    Id int `uri:"id"`
}

func (s *HtTalentGetReq) GetId() interface{} {
    return s.Id
}

// HtTalentDeleteReq 功能删除请求参数
type HtTalentDeleteReq struct {
    Ids []int `json:"ids"`
}
type HtTalentResumeDeleteReq struct {
    TalentId int    `json:"talentId"`
    FileUri  string `json:"fileUri"`
}
type HtTalentImportReq struct {
    Ids []int `json:"ids"`
}

func (s *HtTalentDeleteReq) GetId() interface{} {
    return s.Ids
}
